// 1、属性名:类型, 方法名():返回值类型
// 2、
let person: { name: string, age: number, say(): String, add(num1: number, num2: number): number } = {
    name: "",
    age: 10,
    say() { return this.name + "," + this.age },
    add(num1, num2) { return num1 + num2 }
}

// 可选属性或方法。想一下axios.get或post
let person2: { name: string, age: number, say(): String, add?(num1: number, num2: number): number, sex?: string } = {
    name: "",
    age: 10,
    // sex:"1", // 注意看这里，它也没有报错哦
    say() { return this.name + "," + this.age },
    // add(num1, num2) { return num1 + num2 } //这里也是一样哦，没有报错
}